<template>
	<view style="padding: 5px;">
		<u-grid :col="3" :border="false">
			<u-grid-item v-for="btn in buttons" :key="btn.icon" @click="clickHandle(btn)">
				<u-icon :name="btn.icon" :size="btn.size"></u-icon>
				<view class="grid-text">{{btn.title}}</view>
			</u-grid-item>
		</u-grid>
		<MyTabbar />
	</view>
</template>

<script>
	export default {
		data() {
			return {
				buttons:[
					{
						icon:"/static/icon/purchaseAdd_fill.png",
						size:120,
						title:"新增收购记录",
						page:"/pages/purchase/add/add",
					},
					{
						icon:"/static/icon/sellAdd_fill.png",
						size:120,
						title:"新增出售记录",
						page:"/pages/sell/add/add",
					},
					{
						icon:"/static/icon/grainAdd_fill.png",
						size:120,
						title:"新增粮食种类",
						page:"/pages/grain/add/add",
					},
					{
						icon:"/static/icon/sellerAdd_fill.png",
						size:120,
						title:"新增卖家信息",
						page:"/pages/seller/add/add",
					},
					// {
					// 	icon:"/static/icon/purcharseList_fill.png",
					// 	size:120,
					// 	title:"收购列表",
					// 	page:"/pages/purchase/purchase",
					// 	isTab:true
					// },
					// {
					// 	icon:"/static/icon/sellList_fill.png",
					// 	size:120,
					// 	title:"出售列表",
					// 	page:"/pages/sell/sell",
					// 	isTab:true
					// },
					// {
					// 	icon:"/static/icon/grain_fill.png",
					// 	size:120,
					// 	title:"粮食列表",
					// 	page:"/pages/grain/grain",
					// 	isTab:true
					// },
					{
						icon:"/static/icon/sellerList_fill.png",
						size:120,
						title:"卖家列表",
						page:"/pages/seller/seller",
					},
					{
						icon:"/static/icon/ticketList_fill.png",
						size:120,
						title:"票据列表",
						page:"/pages/ticket/ticket",
					},
				]
			}
		},
		onShow() {
			console.log("工作台");
		},
		methods: {
			clickHandle(btn){
				console.log(btn.page)
				if(btn.isTab){
					uni.switchTab({
						url:btn.page
					});
				}else{
					uni.navigateTo({
						url:btn.page
					});
				}
				
			}
		}
	}
</script>

<style scoped lang="scss">
	.grid-text {
		font-size: 28rpx;
		margin-top: 4rpx;
		color: $u-type-info;
	}
</style>
